﻿/// <reference path="_namespace.js" />
/// <reference path="../../drawing/Timer.js" />
/// <reference path="../../collections/Comparer.js"/>

/*****************************************************************************
Ajaxna library Interface definition.
Author: krobinson 10/13/2008 3:59:33 PM.
Class:  ajax.xna.framework.IUpdateable
*****************************************************************************/

$addNamespace("ajax.xna.framework");
//-----------------------------------------------------------------------------

ajax.xna.framework.IUpdateable = function()
{///<summary>Defines an interface for a game component that should be updated in Game.update().</summary>
}; // ctor should be blank.
$extend("ajax.xna.framework.IUpdateable", ""); // You may also inherit from another interface.
//-----------------------------------------------------------------------------

// Public members
//-----------------------------------------------------------------------------

// Public Methods
//-----------------------------------------------------------------------------
ajax.xna.framework.IUpdateable.prototype.get_enabled = function() 
{///<summary>Indicates whether the game component's IUpdateable.update() method should be called in Game.update().</summary>
 ///<returns type="bool">True if IUpdateable.update() should be called; false otherwise.</returns>    
};
ajax.xna.framework.IUpdateable.prototype.add_enabledChanged = function(handler)
{///<summary>Adds handler for event raised when the IUpdateable.get_enabled() property changes.</summary>
}
ajax.xna.framework.IUpdateable.prototype.remove_enabledChanged = function(handler)
{///<summary>Removes handler for event raised when the IUpdateable.get_enabled() property changes.</summary>
}

ajax.xna.framework.IUpdateable.prototype.get_updateOrder = function()
{///<summary>Indicates when the game component should be updated relative to other game components. Lower values are updated first.</summary>
    ///<returns type="int" integer="true">When the game component should be updated.</returns>
}
ajax.xna.framework.IUpdateable.prototype.add_updateOrderChanged = function(handler)
{///<summary>Adds handler for event raised when the IUpdateable.get_updateOrder() property changes.</summary>
}
ajax.xna.framework.IUpdateable.prototype.remove_updateOrderChanged = function(handler)
{///<summary>Removes handler for event raised when the IUpdateable.get_updateOrder() property changes.</summary>
}

ajax.xna.framework.IUpdateable.prototype.update = function(gameTime)
{///<summary>Called when the game component should be updated.</summary>
 ///<param name="gameTime" type="ajax.drawing.Timer"/>Snapshot of the game's timing state.</param>    
}

// Statics
//-----------------------------------------------------------------------------
ajax.xna.framework.IUpdateable.cast = function(obj)
{///<returns type="ajax.xna.framework.IUpdateable"/>
    return obj;
}

// Comparer object
//-----------------------------------------------------------------------------
ajax.xna.framework.IUpdateable.Comparer = function()
{
}
$extend("ajax.xna.framework.IUpdateable.Comparer", "ajax.collections.Comparer");
if ($getDesignMode())
    ajax.xna.framework.IUpdateable.Comparer.prototype = ajax.collections.Comparer.prototype;

ajax.xna.framework.IUpdateable.Comparer.prototype.compare = function(a, b)
{///<param name="a" type="ajax.xna.framework.IUpdateable"/>
    ///<param name="b" type="ajax.xna.framework.IUpdateable"/>
    if (a.get_updateOrder() < b.get_updateOrder())
        return -1;
    else if (GetObject.get_updateOrder() > b.get_updateOrder())
        return 1;
    return 0;
}